package com.sfh.base.mvp;


import com.sfh.base.ui.dialog.IAlertTemple;

/**
 * 功能描述:使用场景，同界面出现不同要求
 *
 * @date 2017/6/16
 */
public abstract class AbstractView implements IView {
    IView listener;

    public AbstractView(){}

    public AbstractView(IView listener){
        this.listener = listener;
    }
    @Override
    public void showLoading(String message, boolean cancelAble, boolean... isBgColor) {

        if (this.listener == null) {
            return;
        }
        this.listener.showLoading (message, cancelAble,isBgColor);
    }

    @Override
    public void hideLoading() {

        if (this.listener == null) {
            return;
        }
        this.listener.hideLoading ();
    }

    @Override
    public void showDialog(IAlertTemple alert, boolean cancelAble) {

        if (this.listener == null) {
            return;
        }
        this.listener.showDialog (alert, cancelAble);
    }

    @Override
    public void hideDialog() {

        if (this.listener == null) {
            return;
        }
        this.listener.hideDialog ();
    }

    @Override
    public void showToast(String message, int ms, int... gravity) {

        if (this.listener == null) {
            return;
        }
        this.listener.showToast (message, ms, gravity);
    }
}
